/**
 * Copyright (c) 2009 blurredVision
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
 * associated documentation files (the "Software"), to deal in the Software without restriction, 
 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or 
 * substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 
 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT 
 * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#ifndef __IDRAWPRIMITIVE_H__
#define __IDRAWPRIMITIVE_H__

#pragma once

#include <vector>
#include "geom/Vector.h"

enum eDrawPrimitiveType {
	TYPE_PLANE, 
	TYPE_SPHERE,
	TYPE_SCREENQUAD,
	TYPE_QUAD
};

class IRenderer;

class DLL_EXPORT IDrawPrimitive
{
public:
	/// Creates a mapped sphere
	static IDrawPrimitive* CreateSphere(float radius, unsigned int slices, unsigned int stacks);

	/// Creates a plane with the dimension 1
	static IDrawPrimitive* CreatePlane(const math::Vector3 &normal, float d, const math::Vector2i &tesselation);

	static IDrawPrimitive* CreateScreenQuad(int width, int height, int offsetX, int offsetY, float scaleFactor = 1.0f, const math::Vector4 &color = math::Vector4(1,1,1,1));
	static IDrawPrimitive* CreateQuad(int width, int height, const math::Vector4 &color = math::Vector4(1,1,1,1));

	//static IDrawPrimitive* CreateBox(float width, float height, float depth, int tessW = 1, int tessH = 1, int tessD = 1);

	static void GenTriGrid(int numVertRows, int numVertCols, float dx, float dz, std::vector<math::Vector3>& verts, std::vector<DWORD>& indices);

	virtual ~IDrawPrimitive(void);
	
	virtual void draw() = 0;

	eDrawPrimitiveType type;///< The type of the draw primitive
	float radius;			///< for the sphere
	math::Vector3 normal;	///< for the plane
	float distance;			///< for the plane

protected:
	IDrawPrimitive(void);
};

#endif
